#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,t,s;
	string st;
	getline(cin,st);
	int num = 0;
	bool flag = false;
	string temp = "";
	int arr[15] = {0};
	int Temp = 0;
	for(int i = 0; i < st.length(); i++){
		if(st.at(i) == ' ' || i == st.length() - 1){
			if(i == st.length() - 1){
				temp += st.at(i);
			}
			arr[Temp] = stoi(temp);
			temp = "";
			Temp++;
		}else{
			temp += st.at(i);
		}
	}
	n = arr[0];
	t = arr[1];
	s = arr[2];
	if(s != 0) num = t / s;
	else flag = true;
	int sum = 0;
	string str[105] = {""};
	for(int i = 0; i < n; i++) {
		string s;
		getline(cin,s);
		int index_1 = s.find("use");
		if((s.find("ak") > s.length() || s.find("ak") < index_1)  && (s.find("AK") > s.length() || s.find("AK") < index_1) && (s.find("aK") > s.length() || s.find("aK") < index_1) && (s.find("Ak") < index_1 || s.find("Ak") > s.length())) {
			continue;
		} else {
			int index = s.find("hit");
			if(s.find("ash") == 0 && s.find("himself") > index && s.find("himself") < s.length()) {
				str[sum] = "ash";
				sum++;
			}
			if(s.find("ash") > index && s.find("ash") < s.length()) {
				for(int j = 0; j < s.length(); j++) {
					if(s.at(j) == ' ') break;
					str[sum] += s.at(j);
				}
				sum++;
			}
		}
	}
	if(sum > num && flag == false) {
		cout<<"Heros never die."<<endl;
	} else {
		cout<<sum<<endl;
		for(int i = 0; i < sum; i++) {
			cout<<str[i]<<endl;
		}
	}
	return 0;
}









